#include <iostream>
#include <string>

using namespace std;

int main(void)
{
    //cout << "npos= " << string::npos << endl;
    string s1;
    cout << "s1=" << s1.capacity() << endl;
    cout << "s1.size()=" << s1.size() << endl;
    cout << "容器动态数组的首地址=" << (void *)s1.c_str() << endl;
    s1 = "xxxxxxxxxxxxxxxxxxx";
    cout << "s1=" << s1.capacity() << endl;
    cout << "s1.size()=" << s1.size() << endl;
    cout << "容器动态数组的首地址=" << (void *)s1.c_str() << endl;

    string s2("hello C++!");
    cout << "s2=" << s2 << endl;
    string s3 = "hello C++!";
    cout << "s3=" << s3 << endl;
    cout << "容器动态数组的首地址=" << (void *)s3.c_str() << endl;

    string s4(s3);
    cout << "s4=" << s4 << endl;
    cout << "容器动态数组的首地址=" << (void *)s4.c_str() << endl;
    string s5 = s3;
    cout << "s5=" << s5 << endl;
    cout << "容器动态数组的首地址=" << (void *)s5.c_str() << endl;

    string s6("hello world", 5);
    cout << "s6=" << s6 << endl;
    cout << "s6.capacity()=" << s6.capacity() << endl;
    cout << "s6.size()=" << s6.size() << endl;
    string s7("hello world", 50);
    cout << "s7=" << s7 << endl;
    cout << "s7.capacity()=" << s7 .capacity() << endl;
    cout << "s7.size()=" << s7.size() << endl;

    string s8(s3, 3, 5);
    cout << "s8=" << s8 << endl;
    string s9(s3,3,50);
    cout << "s9=" << s9 << endl;
    cout << "s9.capacity()=" << s9 .capacity() << endl;
    cout << "s9.size()=" << s9.size() << endl;
    string s10("hello world", 3, 5);
    cout << "s10=" << s10 << endl;
    string s11("hello world", 3);
    cout << "s11=" << s11 << endl;

    string s12(8, 'x');
    cout << "s12=" << s12 << endl;
    cout << "s12.capacity()=" << s12 .capacity() << endl;
    cout << "s12.size()=" << s12.size() << endl;
    string s13(30, 0);
    cout << "s13=" << s13 << endl;
    cout << "s13.capacity()=" << s13.capacity() << endl;
    cout << "s13.size()=" << s13.size() << endl;

    return 0;
}